const cloud = require('wx-server-sdk')
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV })
exports.main = async (event, context) => {
  const db = cloud.database()
  const {activeId} = event
  try {
    // 1. 执行添加
    const data = await db.collection('actives').doc(activeId)
    .field({
      _id: true,
      name: true,
      location: true,
      detail: true,
      talk: true,
      time: true,
      publisher_id: true,
      publisher:true,
      pic:true,
    }) // 按需获取字段
    .get()
    return { code: 200, message: '查看成功', data:data }
  } catch (err) {
    console.error(err)
    return { code: 500, message: '服务器错误' }
  }
}